Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@zxing/browser

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zxing/browser

ZXing for JS's browser layer.

  • 0.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is @zxing/browser?

@zxing/browser is an npm package that provides tools for barcode scanning and decoding directly in the browser. It leverages the ZXing library, which is a popular open-source barcode image processing library, to offer robust and efficient barcode scanning capabilities.

What are @zxing/browser's main functionalities?

Barcode Scanning from Video Stream

This feature allows you to scan barcodes directly from a video stream, such as from a webcam. The code initializes a `BrowserMultiFormatReader` and starts decoding from the video device, logging the result to the console.

const codeReader = new ZXing.BrowserMultiFormatReader();
codeReader.decodeFromVideoDevice(null, 'video', (result, err) => {
  if (result) {
    console.log(result.text);
  }
  if (err && !(err instanceof ZXing.NotFoundException)) {
    console.error(err);
  }
});

Barcode Scanning from Image

This feature allows you to scan barcodes from an image element. The code initializes a `BrowserMultiFormatReader` and decodes the barcode from the specified image element, logging the result to the console.

const codeReader = new ZXing.BrowserMultiFormatReader();
const imgElement = document.getElementById('img');
codeReader.decodeFromImage(imgElement).then(result => {
  console.log(result.text);
}).catch(err => {
  console.error(err);
});

Barcode Scanning from URL

This feature allows you to scan barcodes from an image URL. The code initializes a `BrowserMultiFormatReader` and decodes the barcode from the specified image URL, logging the result to the console.

const codeReader = new ZXing.BrowserMultiFormatReader();
const imageUrl = 'https://example.com/barcode.png';
codeReader.decodeFromImageUrl(imageUrl).then(result => {
  console.log(result.text);
}).catch(err => {
  console.error(err);
});

Other packages similar to @zxing/browser

Keywords

FAQs

Package last updated on 22 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc